package com.mydemo.dubbo.server.impl;

import com.mydemo.dubbo.GreetingsService;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;

import java.util.concurrent.CountDownLatch;

public class ServerApp {
    public static void main(String[] args) throws InterruptedException {
        ServiceConfig<GreetingsService> serviceConfig = new ServiceConfig<>();
        serviceConfig.setApplication(new ApplicationConfig("first-dubbo-provider"));
        serviceConfig.setRegistry(new RegistryConfig("zookeeper://" + "121.40.91.19" + ":2181"));
        serviceConfig.setInterface(GreetingsService.class);
        serviceConfig.setRef(new GreetingServiceImpl());
        serviceConfig.setTimeout(100000);
        serviceConfig.export();
        System.out.println("dubbo service started");
        new CountDownLatch(1).await();
    }
}
